package com.aiju.widgit;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.widget.TextView;

import com.aiju.utils.PriceUtil;


/**
 * @author: 佐为
 * @date: 2016-12-07 17:45
 * @version: V1.0
 * @Description: 显示两位小数
 */
public class TwoZeroTextView extends TextView {

    public TwoZeroTextView(Context context) {
        super(context);
    }

    public TwoZeroTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void setText(CharSequence text, BufferType type) {
        if (TextUtils.isEmpty(text)) {
            super.setText("0.00", type);
            return;
        }
        super.setText(PriceUtil.formatDouble(text.toString()), type);
    }

}
